<template>
	<view style="padding-top: 20rpx;">
		<!-- <page-head :title="'学员点评'" :headtype="2"></page-head> -->
		<view class="feed marginAuto">
			<!-- <view class="feedmain marginAuto">
				<uv-textarea class="evinputmdata" v-model="feedtxt" confirmType="done" height="228" border="none" placeholder="请输入您对学员的点评~" />
			</view> -->
			<view class="allphoto flex">
				<view class="eachphoto" v-for="(item,index) in photoall" :key="index">
					<uv-icon @click="delfun(item,index)" class="eachphotodel" name="close-circle-fill" color="#999999" size="30"></uv-icon>
					<image class="eachphotoimg" :src="apifun.URLimg+item" mode=""></image>
				</view>
				<view class="eachphoto" v-if="photoall.length < 6" @click="uploadfile()">
					<view class="eachphotoicon marginAuto"><uv-icon name="photo" size="40" color="#999999"></uv-icon></view>
					<view class="eachphototitle">添加照片</view>
				</view>
				<view class="eachphoto" style="border:none;" v-if="parseInt(photoall.length / 3) != 2"></view>
			</view>
		</view>
		<view class="marginAuto" style="width:600rpx;margin-top:100rpx;">
			<uv-button text="提交" @click="enter()" :customStyle="{
				'background':'#0E71EB',
				'color':'#ffffff',
				'font-size':'30rpx',
				'width':'600rpx',
				'height':'100rpx',
				'border-radius':'20rpx'
			}"></uv-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				apifun:this.apifun,
				// feedtxt:'',
				photoall:[]
			};
		},
		onLoad() {
			
		},
		methods: {
			enter(){
				let sendData = {
					img:this.photoall
				};
				this.apifun.unirequest('/coach/user/evaluate','post',sendData,(res)=>{
					if(res.code === 200){
						let datas = res.data;
						this.apifun.toast('提交成功');
						this.apifun.goback();
					}else{
						this.apifun.toast(res.msg)
					}
				})
			},
			uploadfile(){
				this.apifun.uploadFileimg((res)=>{
					if(res.code == 200){
						this.photoall.push(res.data.src)
					}
				})
			},
			delfun(item,index){
				this.photoall.splice(index,1)
			}
		},
	};
</script>

<style scoped lang="scss">
	// 反馈内容
	.feed{
		width: 650rpx;
		padding: 20rpx;
		background: #fff;
		// background: red;
		border-radius: 20rpx;
		.feedmain{
			height: 300rpx;
			.evinputmdata{
				height: 260rpx;
				font-size: 28rpx;
				color: #333;
			}
		}
		.allphoto{
			justify-content:space-between;
			flex-wrap: wrap;
			.eachphoto{
				position: relative;
				width: 200rpx;
				height: 200rpx;
				margin-top: 20rpx;
				border-radius: 10rpx;
				border: 1px solid #BCBCBC;
				.eachphotoimg{
					width: 200rpx;
					height: 200rpx;
					border-radius: 10rpx;
				}
				.eachphotodel{
					position: absolute;
					right:-20rpx;
					top:-20rpx;
					z-index: 10;
				}
				.eachphotoicon{
					width: 70rpx;
					height: 70rpx;
					margin-top: 50rpx;
				}
				.eachphototitle{
					font-size: 24rpx;
					color:#9E9E9E;
					line-height:50rpx;
					text-align: center;
				}
			}
		}
	}
</style>